package qq.com;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class QQRegisterFrame {

	public static void start(){
		JFrame frame = new JFrame("娉ㄥ唽");
		frame.setBounds(500, 300, 400, 350);

		JPanel mainPanel = new JPanel();
		//mainPanel.setBorder(new LineBorder(Color.BLACK,5));
		frame.setContentPane(mainPanel);

		JPanel accountPanel = new JPanel();
		accountPanel.setBounds(100, 60, 200, 50);
		JLabel label = new JLabel("甯愬彿锛�");
		accountPanel.add(label);
		JTextField account = new JTextField();
		account.setColumns(10);
		accountPanel.add(account);
		//accountPanel.setBorder(new LineBorder(Color.RED));
		mainPanel.add(accountPanel);

		JPanel passwordPanel = new JPanel();
		passwordPanel.setBounds(100, 110, 200, 50);
		JLabel label1 = new JLabel("瀵嗙爜锛�");
		passwordPanel.add(label1);
		JPasswordField password = new JPasswordField();
		password.setColumns(10);
		passwordPanel.add(password);
		//passwordPanel.setBorder(new LineBorder(Color.RED));
		mainPanel.add(passwordPanel);

		JPanel btnPanel = new JPanel();
		btnPanel.setBounds(100, 160, 200, 50);
		JButton bt1 = new JButton("娉ㄥ唽");
		bt1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				String user = account.getText();//鑾峰彇甯愬彿杈撳叆妗嗛噷闈㈢殑鍊�
				String pwd = password.getText();
				QQClient.register(user,pwd);
			}
		});
		btnPanel.add(bt1);
		//btnPanel.setBorder(new LineBorder(Color.RED));
		mainPanel.add(btnPanel);


		frame.setLayout(null);//涓嶄娇鐢ㄧ郴缁熷竷灞�鏂瑰紡
		//frame.setLayout(new FlowLayout());//娴佸紡甯冨眬
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//鍏抽棴绐椾綋閫�鍑虹▼搴�
		frame.setVisible(true);
	}

}
